package com.visionblue.business.ship.page.outer

import com.visionblue.business.ship.base.BaseRepository
import com.visionblue.business.ship.model.Results
import com.visionblue.business.ship.model.bean.response.ApplicationDetail
import com.visionblue.business.ship.model.bean.response.ListBean
import com.visionblue.business.ship.model.bean.response.TransferOuterDetail
import com.visionblue.business.ship.model.bean.response.TransportShipInfo
import com.visionblue.business.ship.model.repository.RemoteRepository

/**
 * @author: xlh
 * @date: 2020-06-08 8:03 AM
 * @desc:
 */
class OuterRepository : BaseRepository() {

    suspend fun getTransferOutTasks(page: Int): Results<ListBean<ApplicationDetail>> {
        return safeApiCall(call = { RemoteRepository.getOuterTasks(page, 1) })
    }

    suspend fun getTransporters(): Results<List<TransportShipInfo>> {
        return safeApiCall(call = { RemoteRepository.getTransportShips() })
    }

    suspend fun postTransportApplication(shipNo: String): Results<Any> {
        return safeApiCall(call = { RemoteRepository.postTransportApplication(shipNo) })
    }

    suspend fun cancelOwnApplication(id: String): Results<Any> {
        return safeApiCall(call = { RemoteRepository.cancelOwnApplication(id) })
    }
}